import * as THREE from "three";
import createCamera from "./camera";
import { TWEEN } from 'three/examples/jsm/libs/tween.module.min.js';

const initRenderer = function (context) {
    let { scene, labelRenderer } = context;
    let { camera, renderer } = createCamera(context);

    // 渲染
    const render = () => {
        renderer.render(scene, camera);
        labelRenderer.render(scene, camera); //渲染HTML标签对象
        TWEEN.update();     //补间动画

        //监听鼠标、键盘事件
        requestAnimationFrame(render);
    }
    return { camera, renderer, render };
}


export default initRenderer;